Skip to content

Endpoint /internal/messages#677

Open
hippolyteblot wants to merge 17 commits into
virtual-imaging-platform:developfrom
hippolyteblot:internal_messages
Open

Endpoint /internal/messages#677
hippolyteblot wants to merge 17 commits into
virtual-imaging-platform:developfrom
hippolyteblot:internal_messages

Conversation

@hippolyteblot
Copy link
Copy Markdown
Member

This new PR allows the backend to provide new routes under /internal/messages.

Here are the new endpoints:

  • GET /internal/messages: Returns inbox messages for the current user
  • GET /internal/messages/send: Returns messages sent by the current user
  • GET /internal/messages/groups: Returns inbox group messages for the current user
  • POST /internal/messages: Allows the current user to send a new message (can be a group message)
  • DELETE /internal/messages/{id}: Deletes a message for the current recipient only
  • DELETE /internal/messages/send/{id}: Deletes a message as the sender (removes the message for all recipients)
  • PUT /internal/messages/{id}/read: Marks the message as read by the current user (must be a recipient)

Here is also two new endpoints (and associated business methods) that allows to search for a user, or a group (used for recommendations when sending messages)


@DeleteMapping("/send/{id}")
public void deleteSentMessage(@PathVariable long id) throws VipException {
messageBusiness.remove(id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add in MessageBusiness the verification the message is sent by the current user (or the current user is an admin)

}
}
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will make 2 different endpoints:

  • POST /messages (with a Message model)
  • POST /messages/groups (with a GroupMessage model)

get rid of SendMessageRequest

Simple verification:

  • beginner cannot post on /messages
  • only a group admin of the group specified on the group message (or a VIP admin) can post on /messages/groups

Maybe validation of NotBlank through @notblank annotation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants